BioInfo - Exercices Bash

BioInfo - Exercices Bash

Preparation

cd
cp /home/tludwig/s.omalleysbar.txt .
bash

A. Get the first word from each line (easy)

use cut

cat s.omalleysbar.txt | ... | head -30
bash

B. Sort first word from each line by number of occurrences (medium)

use cut, sort, uniq

cat s.omalleysbar.txt | ... | head -20
bash

C. Get the last word from each line (hard)

use cut, rev

cat s.omalleysbar.txt | ... | head -20
bash

D. Get all the line containing "as" (easy)

use grep -w

cat s.omalleysbar.txt | ... 
bash

E. Get the number of occurrences of "as" (medium)

use grep, wc

cat s.omalleysbar.txt | ... 
bash

F. Sort all words alphabetically (medium)

use tr, sort

cat s.omalleysbar.txt | tr '[:upper:]' '[:lower:]' | ... | head -30

G. Sort all words by number of occurrences (medium-hard)

use tr, sort, uniq

cat s.omalleysbar.txt | tr '[:upper:]' '[:lower:]' | ... | head -30
bash

H. Get all lines with more than 45 characters (hard)

use cut, diff, grep

cat s.omalleysbar.txt | ... 
...
bash